data SEGMENT
    string db 'ABCZ123a0b9c5*&'
    len equ $-string
data ENDS
code SEGMENT
    assume ds:data, cs:code
start:
    mov ax, data
    mov ds, ax
    mov cx, len
    mov dx, 0
    lea di, string
    count:
        mov al, [di]
; dl number
        cmp al, '0'
        jl next
        cmp al, '9'
        jg alpha
        inc dl
        jmp next
; dh upper
    alpha:
        cmp al, 'A'
        jl next
        cmp al, 'Z'
        jg next
        inc dh
    next:
        inc di
        loop count
;cl others
    mov cl, len
    sub cl, dh
    sub cl, dl
    mov ax, 4c00h
    int 21h
code ENDS
end start